package com.chexiehui.jc.mvp.login;

import com.chexiehui.jc.Constants;
import com.chexiehui.jc.base.BaseModel;
import com.chexiehui.jc.base.BaseView;
import com.chexiehui.jc.entity.AuthInfo;
import com.chexiehui.jc.entity.UserInfo;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @Description 找回密码
 * @Auth SongJun
 * @Date 2019/11/20 10:05
 **/
public interface FindPasswordCovenant {

    interface View extends BaseView {
        void onGetCodeSuccess(BaseModel<Object> successResult);

        void onGetCodeFailure(BaseModel<Object> failureResult);

        void onCheckCodeSuccess(BaseModel<Object> successResult);

        void onCheckCodeFailure(BaseModel<Object> failureResult);

        void onSubmitSuccess(BaseModel<AuthInfo> successResult);

        void onSubmitFailure(BaseModel<Object> failureResult);

        void onGetUserInfoSuccess(BaseModel<UserInfo> successResult);

        void onGetUserInfoFailure(BaseModel<Object> failureResult);

        String getIm();
    }

    interface Stores {
        @FormUrlEncoded
        @POST(Constants.SEND_CODE)
        Observable<BaseModel<Object>> getCode(
                @Field("phone") String phone);

        @FormUrlEncoded
        @POST(Constants.CHECK_CODE)
        Observable<BaseModel<Object>> checkCode(@Field("phone") String phone, @Field("code") String code);

        @FormUrlEncoded
        @POST(Constants.URL_FIND_PASSWORD)
        Observable<BaseModel<AuthInfo>> submit(
                @Field("phone") String phone,
                @Field("code") String code,
                @Field("password") String password,
                @Field("im") String im);

        @FormUrlEncoded
        @POST(Constants.URL_GET_USER_INFO)
        Observable<BaseModel<UserInfo>> getUserInfo(@Field("timespan") String timespan);

    }

    interface Presenter {
        void getCode(String phone);
        void getCheckCode(String phone,String code);

        void submit(String phone, String code, String firstPassword, String secondPassword);

        void getUserInfo();
    }

}